<?php
class JobDetail extends AppModel {
	var $name = 'JobDetail';
	var $validate = array(
		'jobno' => array(
			'alphanumeric' => array(
				'rule' => array('alphanumeric'),
				'message' => 'Only Numbers and Characters are allowed',
			),
		),
		'qualification' => array(
			'notempty' => array(
				'rule' => array('notempty'),
				'message' => 'Enter Minimum Qualification Required',
			),
		),
		'number' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				'messaage' => 'Enter Number of Vaccency.'
			),
		),
		'end_date' => array(
			'date' => array(
				'rule' => array('date'),
				'message' => 'Date Required',
			),
		),
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $belongsTo = array(
		'User' => array(
			'className' => 'User',
			'foreignKey' => 'user_id',
		),
		'JobProvider' => array(
			'className' => 'JobProvider',
			'foreignKey' => 'job_provider_id',
		)
	);

	var $hasAndBelongsToMany = array(
		'JobCategory' => array(
			'className' => 'JobCategory',
			'joinTable' => 'job_categories_job_details',
			'foreignKey' => 'job_detail_id',
			'associationForeignKey' => 'job_category_id',
			'unique' => true,
		),
		'Staff' => array(
			'className' => 'Staff',
			'joinTable' => 'job_details_staffs',
			'foreignKey' => 'job_detail_id',
			'associationForeignKey' => 'staff_id',
			'unique' => true,
		)
	);
}
?>